/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tutorial.LooseCoupling.robot;

import tutorial.LooseCoupling.robot.interfaces.Body;
import tutorial.LooseCoupling.robot.interfaces.Weapon;

/**
 * 
 * @author Boogie
 */
public class Robot {
    /*
     * Body si Weapon sunt interfete(adica nu au implementare concreta)
     * Dupa cum se vede clasa Robot habar n-are nimic despre implementarea 
     * lui Body si Weapon acestea vor fi implementate si injectate ulterior, fie
     * prin constructor, fie prin setterii corespunzatori
     */
    private Body body;
    private Weapon weapon;
    
    public Robot(){        
    }

    public Robot(Body body, Weapon weapon) {
        this.body = body;
        this.weapon = weapon;
    }
    
    public void move(){
        if(body!=null)//verificare in caz ca Robot a fost instantat cu new Robot();
            body.move();
    }
    
    
    public void attack(){
        if(weapon!=null)//verificare in caz ca Robot a fost instantat cu new Robot();
            weapon.attack();
    }
    /*
     * cu ajutorul acestor metode se poate schimba in mod dinamic implementarea
     * asta este un mic bonus poate fi adus de catre acest mod de a programa
     */
    public void setBody(Body body) {
        this.body = body;
    }


    public void setWeapon(Weapon weapon) {
        this.weapon = weapon;
    }
    
    
    
}
